1 <?php include ( "inc/connect.inc.php" ); ?>
2 <?php
3
4 ob_start();
5 session_start();

6 if
(!isset($_SESSION['user_login'])) {
7     header(
"location: login.php");
8 }

9 else
{
10     $user = $_SESSION[
'user_login'];
11     $result = mysql_query(
"SELECT * FROM user WHERE id='$user'");
12         $get_user_email = mysql_fetch_assoc($result);
13             $uname_db = $get_user_email[
'firstName'];
14             $uemail_db = $get_user_email[
'email'];
15             $upass = $get_user_email[
'password'];
16
17             $umob_db = $get_user_email[
'mobile'];
18             $uadd_db = $get_user_email[
'address'];
19 }

20
21 if
(isset($_REQUEST['uid'])) {
22     
23     $user2 = mysql_real_escape_string($_REQUEST[
'uid']);
24     
if($user != $user2){
25         header(
'location: index.php');
26     }
27 }
else {
28     header(
'location: index.php');
29 }

30
31 if
(isset($_POST['changesettings'])) {
32 //declere veriable

33 $email = $_POST[
'email'];
34 $opass = $_POST[
'opass'];
35 $npass = $_POST[
'npass'];
36 $npass1 = $_POST[
'npass1'];
37 //triming name

38     
try {
39         
if(empty($_POST['email'])) {
40             
throw new Exception('Email can not be empty');
41             
42         }
43             
if(isset($opass) && isset($npass) && isset($npass1) && ($opass != "" && $npass != "" && $npass1 != "")){
44                 
if( md5($opass) == $upass){
45                     
if($npass == $npass1){
46                         $npass = md5($npass);
47                         mysql_query(
"UPDATE user SET password='$npass' WHERE id='$user'");
48                         $success_message =
'
49                         <div
class="signupform_text" style="font-size: 18px; text-align: center;">
50                         <font face=
"bookman">
51                             Password changed.
52                         </font></div>
';
53                     }
else {
54                     $success_message =
'
55                         <div
class="signupform_text" style=" color: red; font-size: 18px; text-align: center;">
56                         <font face=
"bookman">
57                             New password not matched!
58                         </font></div>
';
59                     }
60                 }
else {
61                 $success_message =
'
62                     <div
class="signupform_text" style=" color: red; font-size: 18px; text-align: center;">
63                     <font face=
"bookman">
64                         Fillup password field exactly.
65                     </font></div>
';
66                 }
67             }
else {
68                 $success_message =
'
69                     <div
class="signupform_text" style=" color: red; font-size: 18px; text-align: center;">
70                     <font face=
"bookman">
71                         Fillup password field exactly.
72                     </font></div>
';
73                 }
74
75             
if($uemail_db != $email) {
76                 
if(mysql_query("UPDATE user SET email='$email' WHERE id='$user'")){
77                     
//success message
78                     $success_message =
'
79                     <div
class="signupform_text" style="font-size: 18px; text-align: center;">
80                     <font face=
"bookman">
81                         Settings change successfull.
82                     </font></div>
';
83                 }
84             }
85
86     }
87     
catch(Exception $e) {
88         $error_message = $e->getMessage();
89     }
90 }
91
92
93 ?>
94
95 <!DOCTYPE html>
96 <html>
97 <head>
98     <title>SAREE</title>
99     <link rel=
"stylesheet" type="text/css" href="css/style.css">
100     <meta name=
"viewport" content="width=device-width, initial-scale=1">
101 </head>
102 <body style=
"background-image: url(image/homebackgrndimg1.png);">
103     <div
class="homepageheader">
104             <div
class="signinButton loginButton">
105                 <div
class="uiloginbutton signinButton loginButton" style="margin-right: 40px;">
106                     <?php
107                         
if ($user!="") {
108                             echo
'<a style="text-decoration: none; color: #fff;" href="logout.php">LOG OUT</a>';
109                         }
110                         
else {
111                             echo
'<a style="text-decoration: none; color: #fff;" href="signin.php">SIGN IN</a>';
112                         }
113                      ?>
114                     
115                 </div>
116                 <div
class="uiloginbutton signinButton loginButton" style="">
117                     <?php
118                         
if ($user!="") {
119                             echo
'<a style="text-decoration: none; color: #fff;" href="profile.php?uid='.$user.'">Hi '.$uname_db.'</a>';
120                         }
121                         
else {
122                             echo
'<a style="text-decoration: none; color: #fff;" href="login.php">LOG IN</a>';
123                         }
124                      ?>
125                 </div>
126             </div>
127             <div style=
"float: left; margin: 5px 0px 0px 23px;">
128                 <a href=
"index.php">
129                     <img style=
" height: 75px; width: 130px;" src="image/ebuybdlogo.png">
130                 </a>
131             </div>
132             <div
class="">
133                 <div id=
"srcheader">
134                     <form id=
"newsearch" method="get" action="http://www.google.com">
135                             <input type=
"text" class="srctextinput" name="q" size="21" maxlength="120" placeholder="Search Here..."><input type="submit" value="search" class="srcbutton" >
136                     </form>
137                 <div
class="srcclear"></div>
138                 </div>
139             </div>
140         </div>
141     <div
class="categolis">
142         <table>
143             <tr>
144                 <th>
145                     <a href=
"women/saree.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Saree</a>
146                 </th>
147                 <th><a href=
"women/ornament.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Ornament</a></th>
148                 <th><a href=
"women/watch.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Watch</a></th>
149                 <th><a href=
"women/perfume.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Perfume</a></th>
150                 <th><a href=
"women/hijab.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Hijab</a></th>
151                 <th><a href=
"women/tshirt.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">T-Shirt</a></th>
152                 <th><a href=
"women/footwear.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">FootWear</a></th>
153                 <th><a href=
"women/toilatry.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Toilatry</a></th>
154             </tr>
155         </table>
156     </div>
157     <div style=
"margin-top: 20px;">
158         <div style=
"width: 901px; margin: 0 auto;">
159         
160             <ul>
161                 <li style=
"float: left;">
162                     <div
class="settingsleftcontent">
163                         <ul>
164                             <li><?php echo
'<a href="profile.php?uid='.$user.'" >My Orders</a>'; ?></li>
165                             <li><?php echo
'<a href="settings.php?uid='.$user.'" style=" background-color: #169e8f; border-radius: 4px; color: #fff;">Settings</a>'; ?></li>
166                         </ul>
167                     </div>
168                 </li>
169                 <li style=
"float: right;">
170                     <div
class="holecontainer" style=" padding-top: 20px; padding: 0 20%">
171                         <form action=
"" method="POST" class="registration">
172                             <div
class="container signupform_content ">
173                                 <div style=
"text-align: center;font-size: 20px;color: #fff;margin: 0 0 5px 0;">
174                                     <td >Change Password:</td>
175                                 </div>
176                                 <div>
177                                     <td><input
class="email signupbox" type="password" name="opass" placeholder="Old Password"></td>
178                                 </div>
179                                 <div>
180                                     <td><input
class="email signupbox" type="password" name="npass" placeholder="New Password"></td>
181                                 </div>
182                                 <div>
183                                     <td><input
class="email signupbox" type="password" name="npass1" placeholder="Repeat Password"></td>
184                                 </div>
185                                 <div style=
"text-align: center;font-size: 20px;color: #fff;margin: 0 0 5px 0;">
186                                     <td >Change Email:</td>
187                                 </div>
188                                 <div>
189                                     <td><?php echo
'<input class="email signupbox" required type="email" name="email" placeholder="New Email" value="'.$uemail_db.'">'; ?></td>
190                                 </div>
191                                 <div>
192                                     <td><input
class="uisignupbutton signupbutton" type="submit" name="changesettings" value="Update Settings"></td>
193                                 </div>
194                                 <div>
195                                     <?php
if (isset($success_message)) {echo $success_message;} ?>
196                                 </div>
197                             </div>
198                         </form>
199                     </div>
200                 </li>
201             </ul>
202         </div>
203     </div>
204
205     
206 </body>
207 </html>


Gõ tìm kiếm nhanh...